package com.jysz.certificate.persistence.dao.pm;

import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import com.jysz.certificate.persistence.dao.AbstractBaseDao;
import com.jysz.certificate.persistence.model.pm.PAShopMonthDetail;
import com.jysz.certificate.persistence.model.pm.PerformanceAssignShopDetail;

/**
 * @author <a href="mailto:javaengine@outlook.com">Kaca Rich</a>
 *
 */
@Repository
public class PAShopMonthDetailDao extends AbstractBaseDao<PAShopMonthDetail, Long> {

	@SuppressWarnings("unchecked")
	public List<PAShopMonthDetail> findByShopDetail(
			PerformanceAssignShopDetail entity) {
		Criteria criteria = createCriteria();
		criteria.add(Restrictions.eq("performanceAssignShopDetail", entity));
		criteria.addOrder(Order.desc("monthDate"));
		
		return criteria.list();
	}

}
